Skip to content

[BUG] Return tx.Error from InsertOnConflictDoNothing on Create failure#6890

Open
cuiweixie wants to merge 1 commit intochroma-core:mainfrom
cuiweixie:fix/collection-insert-conflict-return-tx-error
Open

[BUG] Return tx.Error from InsertOnConflictDoNothing on Create failure#6890
cuiweixie wants to merge 1 commit intochroma-core:mainfrom
cuiweixie:fix/collection-insert-conflict-return-tx-error

Conversation

@cuiweixie
Copy link
Copy Markdown

Summary

Use tx.Error for logging and the return value when Create fails in InsertOnConflictDoNothing, so callers observe the real GORM error.

Fixes #6889

The error path logged and returned the named err result instead of the
GORM transaction error, so callers could get a nil or stale error when
Create failed.
@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Copy Markdown
Contributor

Fix InsertOnConflictDoNothing to Return Actual GORM Transaction Error

This PR fixes the error path in InsertOnConflictDoNothing within go/pkg/sysdb/metastore/db/dao/collection.go. When Create fails, the method now logs and returns tx.Error instead of the named return variable err, which could previously be nil or stale.

The change is tightly scoped (2 lines replaced) and aligns with the stated intent in the PR description: ensure callers receive the real GORM error from the failed transaction, improving correctness of error propagation and observability.

This summary was automatically generated by @propel-code-bot

Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review found no issues; the targeted fix correctly improves transaction error propagation.

Status: No Issues Found | Risk: Low

Review Details

📁 1 files reviewed | 💬 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] InsertOnConflictDoNothing returns wrong error on Create failure

1 participant